#ifndef SIGNATURE_H_
#define SIGNATURE_H_

#include "ValueType.h"

#include "../syntax_tree.h"
#include "../main_container.h"

#include <string>
#include <vector>
#include <map>

extern MainContainer *CompilerData;

/**
 * @brief Method signature includes method name and parameter types.
	*        Implemented is also a return type, as well as parameter names.
	*        The == operator will return true even though these are different.
 */
class Signature {
private:
	/** Return type for the method. */
	ValueType *returnType;
	/** Name of the method. */
	std::string name;
	/** Arguments' types. */
	std::vector<ValueType *> arguments;
	/**
	 * Determines whether this is a signature of a constructor. If so, returnType is set to the class that the constructor belongs to.
	 * However, getReturnType will return null. Call getReturnNype() for a ValueType returned by this method. This is to differentiate
		* between constructors and other methods with the same signature, without the need to explicitly test whether this is a constructor.
		*/
	bool ctor;

public:
	Signature(const SyntaxTreeNode &syntaxNode, int id, ValueType *envelopingType = NULL);

	ValueType &getReturnType();
	std::vector<ValueType *> getArguments();
	int getArgumentNumber();
	ValueType &getArgumentType(int argumentNumber);
	std::string getName();

	bool operator==(const Signature &sig) const;
	bool operator!=(const Signature &sig) const;
};

#endif /* SIGNATURE_H_ */